package com.stn.zjx.givingtreasure.net.impl;

import android.annotation.SuppressLint;
import android.widget.Toast;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheEntity;
import com.lzy.okgo.cache.CacheMode;
import com.lzy.okgo.callback.StringCallback;
import com.stn.zjx.givingtreasure.net.UserApi;
import com.stn.zjx.givingtreasure.net.UserMoneyIntegralApi;
import com.stn.zjx.givingtreasure.utils.ToolsUtils;
import com.vondear.rxtools.view.RxToast;

import org.json.JSONObject;

public class UserMoneyIntegralImpl {

    /**
     * @apiNote 获取用户余额
     * @param tag 标签
     * @param callback 请求回调
     */
    @SuppressLint("CheckResult")
    public static void get_money(String token, String tag, StringCallback callback){
        String data="";
        JSONObject jsonObject=new JSONObject();
        try {
            data= ToolsUtils.getEncryptionParams(jsonObject.toString());
        } catch (Exception e) {
            e.printStackTrace();

        }
        OkGo.<String>post(UserMoneyIntegralApi.get_money)
                .tag(tag)
                .isSpliceUrl(true)
                .cacheTime(CacheEntity.CACHE_NEVER_EXPIRE)
                .cacheKey(tag)
                .cacheMode(CacheMode.FIRST_CACHE_THEN_REQUEST)
                .upJson("")
                .params("token",token)

                .execute(callback);
    }

    /**
     * @apiNote 获取用户余额
     * @param tag 标签
     * @param callback 请求回调
     */
    @SuppressLint("CheckResult")
    public static void get_integral(String token, String tag, StringCallback callback){
        String data="";
        JSONObject jsonObject=new JSONObject();
        try {
            data= ToolsUtils.getEncryptionParams(jsonObject.toString());
        } catch (Exception e) {
            e.printStackTrace();

        }
        OkGo.<String>post(UserMoneyIntegralApi.get_integral)
                .tag(tag)
                .isSpliceUrl(true)
                .cacheTime(CacheEntity.CACHE_NEVER_EXPIRE)
                .cacheKey(tag)
                .cacheMode(CacheMode.FIRST_CACHE_THEN_REQUEST)
                .upJson("")
                .params("token",token)

                .execute(callback);
    }




}
